//
//  HYCDestinationCell.m
//  FamilyTravel
//
//  Created by dllo on 15/10/23.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "HYCDestinationCell.h"
#import "HYCDestinationModel.h"
#import <UIImageView+WebCache.h>
#define WIDTH self.contentView.frame.size.width
#define HEIFGT self.contentView.frame.size.height
@implementation HYCDestinationCell





- (void)dealloc {
    [_myImageView release];
    [_myLabel release];
    [_view release];
    
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}
- (void)createCell {
    self.view = [[UIView alloc] init];
    [self.contentView addSubview:self.view];
    [_view release];
    
    self.myImageView = [[UIImageView alloc] init];
    [self.view addSubview:self.myImageView];
//    self.myImageView.backgroundColor = [UIColor redColor];
    self.myImageView.layer.borderWidth = 1;;
    self.myImageView.layer.cornerRadius = 10;
    self.myImageView.layer.masksToBounds = YES;
    [_myImageView release];
    
    self.myLabel = [[UILabel alloc] init];
    [self.view addSubview:self.myLabel];
    self.myLabel.textAlignment = NSTextAlignmentCenter;
    self.myLabel.shadowOffset = CGSizeMake(0.5, 0.5);
//    self.myLabel.backgroundColor = [UIColor whiteColor];
    [_myLabel release];
    self.myLabel.font = [UIFont systemFontOfSize:16];
    
    self.enLabel = [[UILabel alloc] init];
    [self.view addSubview:self.enLabel];
    self.enLabel.textAlignment = NSTextAlignmentCenter;
    self.enLabel.shadowOffset = CGSizeMake(1, 1);
//    self.myLabel.backgroundColor = [UIColor yellowColor];
    [_myLabel release];
    self.enLabel.font = [UIFont systemFontOfSize:16];
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.view.frame = CGRectMake(0, 0, WIDTH, HEIFGT);
    self.myLabel.frame = CGRectMake(WIDTH  / 1.38, HEIFGT / 11, WIDTH / 4.16, HEIFGT / 7.33);
    self.myImageView.frame = CGRectMake(10, 5, WIDTH - 20, HEIFGT - 10);
    self.enLabel.frame = CGRectMake(WIDTH / 1.38, HEIFGT / 4.88 , WIDTH / 4.166, HEIFGT / 7.33);
}


- (void)setModel:(HYCDestinationModel *)model {
    if (self.model != model) {
        [_model release];
        _model = [model retain];
        
//         _hotlabel.text = _model.title;
    
        
        _myLabel.text = _model.cnname;
        _enLabel.text = _model.enname;
        [_myImageView sd_setImageWithURL:[NSURL URLWithString:_model.photo]placeholderImage:[UIImage imageNamed:@"zw.png"]];
        
    }
}








- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
